/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package aqu.persistencia.entity;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Verito Ramirez
 *         Victor Jaramillo
 */
@Entity
@Table(name = "cxc_detallefactura")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "CxcDetalleFactura.findAll", query = "SELECT c FROM CxcDetalleFactura c"),
    @NamedQuery(name = "CxcDetalleFactura.findBycxcCodigoDetfac", query = "SELECT c FROM CxcDetalleFactura c WHERE c.cxcCodigoDetfac = :cxcCodigoDetfac"),
    @NamedQuery(name = "CxcDetalleFactura.findBycxcDescripcionDetfac", query = "SELECT c FROM CxcDetalleFactura c WHERE c.cxcDescripcionDetfac = :cxcDescripcionDetfac"),
    @NamedQuery(name = "CxcDetalleFactura.findBycxcCantidadDetfac", query = "SELECT c FROM CxcDetalleFactura c WHERE c.cxcCantidadDetfac = :cxcCantidadDetfac"),
    @NamedQuery(name = "CxcDetalleFactura.findBycxcSaldoDetfac", query = "SELECT c FROM CxcDetalleFactura c WHERE c.cxcSaldoDetfac = :cxcSaldoDetfac"),
    @NamedQuery(name = "CxcDetalleFactura.findBycxcCodigoCabfac", query = "SELECT c FROM CxcDetalleFactura c WHERE c.cxcCodigoCabfac = :cxcCodigoCabfac"),
    @NamedQuery(name = "CxcDetalleFactura.findBycxpCodigoRet", query = "SELECT c FROM CxpDetalleFactura c WHERE c.cxpCodigoRet = :cxpCodigoRet"),
    @NamedQuery(name = "CxcDetalleFactura.findBycxcAplicaRetDetFact", query = "SELECT c FROM CxcDetalleFactura c WHERE c.cxcAplicaRetDetFact = :cxcAplicaRetDetFact"),
    @NamedQuery(name = "CxcDetalleFactura.findBycxcAplicaIvaDetFac", query = "SELECT c FROM CxcDetalleFactura c WHERE c.cxcAplicaIvaDetFac = :cxcAplicaIvaDetFac")})
public class CxcDetalleFactura implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 10)
    @Column(name = "CXC_CODIGO_DETFAC")
    private String cxcCodigoDetfac;
    @Size(max = 200)
    @Column(name = "CXC_DESCRIPCION_DETFAC")
    private String cxcDescripcionDetfac;
    @Column(name = "CXC_CANTIDAD_DETFAC")
    private double cxcCantidadDetfac; 
    @Column(name = "CXC_SALDO_DETFAC")
    private double cxcSaldoDetfac; 
    @JoinColumn(name = "CXC_CODIGO_CABFAC", referencedColumnName = "CXC_CODIGO_CABFAC")
    @ManyToOne(optional = false)
    private CxcCabeceraFactura cxcCodigoCabfac;
    @JoinColumn(name = "CXP_CODIGO_RET", referencedColumnName = "CXP_CODIGO_RET")
    @ManyToOne(optional = true)
    private CxpRetencion cxpCodigoRet;
    @Size(max = 2)
    @Column(name = "CXC_APLICARET_DETFAC")
    private String cxcAplicaRetDetFact;
    @Size(max = 2)
    @Column(name = "CXC_APLICAIVA_DETFAC")
    private String cxcAplicaIvaDetFac;
 
    public CxcDetalleFactura() {
    }

    public CxcDetalleFactura(String cxcCodigoDetfac) {
        this.cxcCodigoDetfac = cxcCodigoDetfac;
    }

    public double getCxcSaldoDetfac() {
        return cxcSaldoDetfac;
    }

    public void setCxcSaldoDetfac(double cxcSaldoDetfac) {
        this.cxcSaldoDetfac = cxcSaldoDetfac;
    }

    public String getCxcAplicaIvaDetFac() {
        return cxcAplicaIvaDetFac;
    }

    public void setCxcAplicaIvaDetFac(String cxcAplicaIvaDetFac) {
        this.cxcAplicaIvaDetFac = cxcAplicaIvaDetFac;
    }

    public String getCxcAplicaRetDetFact() {
        return cxcAplicaRetDetFact;
    }

    public void setCxcAplicaRetDetFact(String cxcAplicaRetDetFact) {
        this.cxcAplicaRetDetFact = cxcAplicaRetDetFact;
    }

    public double getCxcCantidadDetfac() {
        return cxcCantidadDetfac;
    }

    public void setCxcCantidadDetfac(double cxcCantidadDetfac) {
        this.cxcCantidadDetfac = cxcCantidadDetfac;
    }

    public CxcCabeceraFactura getCxcCodigoCabfac() {
        return cxcCodigoCabfac;
    }

    public void setCxcCodigoCabfac(CxcCabeceraFactura cxcCodigoCabfac) {
        this.cxcCodigoCabfac = cxcCodigoCabfac;
    }

    
    public String getCxcCodigoDetfac() {
        return cxcCodigoDetfac;
    }

    public void setCxcCodigoDetfac(String cxcCodigoDetfac) {
        this.cxcCodigoDetfac = cxcCodigoDetfac;
    }

    public String getCxcDescripcionDetfac() {
        return cxcDescripcionDetfac;
    }

    public void setCxcDescripcionDetfac(String cxcDescripcionDetfac) {
        this.cxcDescripcionDetfac = cxcDescripcionDetfac;
    }

    public CxpRetencion getCxpCodigoRet() {
        return cxpCodigoRet;
    }

    public void setCxpCodigoRet(CxpRetencion cxpCodigoRet) {
        this.cxpCodigoRet = cxpCodigoRet;
    }

   
    
    
    
    
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (cxcCodigoDetfac != null ? cxcCodigoDetfac.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CxcDetalleFactura)) {
            return false;
        }
        CxcDetalleFactura other = (CxcDetalleFactura) object;
        if ((this.cxcCodigoDetfac == null && other.cxcCodigoDetfac != null) || (this.cxcCodigoDetfac != null && !this.cxcCodigoDetfac.equals(other.cxcCodigoDetfac))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "pppp.CxcDetallefactura[ cxcCodigoDetfac=" + cxcCodigoDetfac + " ]";
    }
    
}
